package TOP101;

import java.util.ArrayList;
import java.util.Stack;

/**
 * @Question BM31
 * @Date 2022/11/12 10:55
 * @Solution
 */
public class BM31 {
    boolean isSymmetrical(TreeNode pRoot) {
        if(pRoot==null) {
            return true;
        }
        return  order(pRoot.left,pRoot.right);
    }
    public Boolean order(TreeNode root1,TreeNode root2) {
        if(root1==null && root2==null) {
            return true;
        }
        if(root1==null ||root2==null ||root1.val!=root2.val) {
            return false;
        }
        return order(root1.left,root2.right) && order(root1.right,root2.left);
    }
}
